<?php
/**
 * Enter description here...
 *	
 * STATUS_DISABLE 0 
 * STATUS_ABLE 1 
 */
class UserPur extends CActiveRecord {
	public static function model($className = __CLASS__) {
		return parent::model ( $className );
	}
	
	public function tableName() {
		return '{{user_pur}}';
	}
	
	public function rules() {
		return array (
			
			array (
				
				'uid, purid', 
				'safe', 
				'message' => '不能为空' 
			) 
		);
	}
	
	public function relations() {
		return array ();
	}
	
	public function attributeLabels() {
		return array (
			
			'uid' => 'uid', 
			'purid' => 'purid' 
		);
	}
	public function getUserPurByUid($uid) {
		$rows = $this->findAll ( array (
			
			"condition" => "uid='$uid'"
		) );
		$ret = CommonFunc::YiiobjectToArray ( $rows, "all" );
		return $ret;
	}
	public function setPur($uid, $purid) {
		$this->uid = $uid;
		$this->purid = $purid;
		$this->save ();
	}
}
?>
